﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using ERPStore.Extensions;

using CloudSoft.Extensions;

namespace ERPStore.Exporter
{
	public static class ProductExtensions
	{
		public static bool IsNotExporatable(this ERPStore.Models.Product product)
		{
			if (product.BestPrice.Value == 0)
			{
				return true;
			}

			if (product.SaleMode != ERPStore.Models.ProductSaleMode.Sellable)
			{
				return true;
			}

			if (product.IsParentVariation)
			{
				return true;
			}

			return false;
		}

		public static bool IsNotExportableForCPC(this ERPStore.Models.Product product)
		{
			if (product.DefaultImage == null)
			{
				return true;
			}

			// Ne pas puber les produits ou il n'existe que le titre
			if (product.LongDescription.IsNullOrTrimmedEmpty()
				&& product.ShortDescription.IsNullOrTrimmedEmpty()
				&& product.StrengthsPoints.IsNullOrTrimmedEmpty())
			{
				return true;
			}

			return false;
		}
	}
}
